Exercise 5 (Homework 7).
(P,
NP,
Kleene star)
Closure under the Kleene star
Show that \mathsf{P} is closed under the Kleene star.
TipUse dynamic programming. Given a set A \in \mathsf{P} over \Sigma and an input x = x_1 \dots x_n for x_i \in \Sigma, build a table indicating for each i < j whether the substring x_i \dots x_j is in A^*.
Show that \mathsf{NP} is closed under the Kleene star.